﻿using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using Webdiyer.WebControls.Mvc;

namespace WebShop.DAL.Interfaces
{
    public interface IRepositoryUnit<T, TId>
    {
        void Create(T objectToCreate);
        void Delete(TId id);
        void Edit(T objectToUpdate);
        T Get(TId id);
        T Find(Expression<Func<T, bool>> predicate);

        IEnumerable<T> List();
        PagedList<T> List(int? page, int pageSize);
        PagedList<T> FindList(int? page, int pageSize, Expression<System.Func<T, bool>> predicate = null, Expression<System.Func<T, string>> orderBy = null, bool ascending = true);

        void Detach(T objectToDetach);
        void SaveChanges();
    }
}
